﻿#include <Sys\RenderUnit\SysRenderDatagram\GROUPRD.HPP>
#include <Render\Render_Win32\Render_Win32_OpenGL\RENDER_WIN32_OPENGL.HPP>
#include <Sys\RenderUnit\SYSDDCLASSID.HPP>

using namespace CxxlMan;
using namespace Cxxl3D;

class CGroupDD_OpenGL:public IDatagramDisposal_OpenGL, public IGroupBridge
{

  virtual bool cxxlFASTCALL Exec(const Smart_Ptr<IRenderDatagramDisposalCenterOpengl> &IRenderDatagramDisposalCenter_Arg,
    const Smart_Ptr<IRenderDatagram> &IRenderDatagram_Arg, const CxxlMan::CSmart_Ptr<Matrix4x4> &ViewMatrix_Arg)
  {
    Smart_Ptr<IGroupRD> IGroupRD_Ptr = (IGroupRD*)GetDefaultInterface(IRenderDatagram_Arg);
    Smart_Ptr<cxxlList<IRenderDatagram> > IRenderDatagram_List = GetList(IGroupRD_Ptr);

    unsigned long Count = IRenderDatagram_List->GetCount();
    IRenderDatagram_List->ResetPT(toHead);
    for(Smart_Ptr<IRenderDatagram> IRenderDatagram_Ptr = (*IRenderDatagram_List)++; Count; --Count, IRenderDatagram_Ptr = (*IRenderDatagram_List)++)
      if( IRenderDatagramDisposalCenter_Arg->Exec(IRenderDatagram_Ptr,ViewMatrix_Arg) == false)
        return false;

    return true;
  }
public:

  // Consteructor
  CGroupDD_OpenGL()
    :cxxlObject(Spirit_Easy)
  {
  }

  // Desteructor
  virtual ~CGroupDD_OpenGL()
  {
  }

};

cxxlObject *cxxlFASTCALL New_CGroupDD_OpenGL()
{
  return new CGroupDD_OpenGL;
}